<!doctype html>
<html lang="zh">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <title>js——BOM、DOM</title>
    <link href="https://cdn.bootcss.com/twitter-bootstrap/4.4.1/css/bootstrap.css" rel="stylesheet">
    <link href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="https://cdn.bootcss.com/animate.css/3.7.2/animate.min.css" rel="stylesheet">
</head>

<body class="container">
    <style>
        .red {
            color: red;
        }

    </style>

    <header>
        <h1 class="text-center">js——BOM、DOM</h1>
        <h1 class="text-center">js——BOM、DOM</h1>
    </header>
    <main>
        <p>等等</p>
    </main>
    <footer></footer>
    <script src="https://cdn.bootcss.com/vue/2.6.11/vue.js"></script>
    <script>
        var results = document.getElementsByTagName('h1');
        for (const key in results) {
            console.log(key);
        }
        var classContent = results[0].className;
        results[0].className = results[0].className + ' red';

        var oP = document.createElement("p");
        var oText = document.createTextNode("这是一个使用 DOM 生成的段落");
        oP.appendChild(oText);
        document.body.appendChild(oP);

        var a = 0, b = 1;
        console.time("timer");
        for (var i = 0; i < 10000; i++) { }
        console.assert(a === 1, "这时候条件是a==1,实际a是1");
        console.assert(b === 1, "这时候条件是b==1，实际b是2"); //断言
        console.warn("这是一段警告信息");
        console.error("出错啦，你的配置信息有误");
        console.timeEnd("timer");
    </script>
</body>

</html>